﻿
	<div id="step2_pop_inside" style="display:none">
		<div class="hd">提示</div>
		<div class="content">
			<h2>恭喜你已成功领取<span style="color:#f15a28; font-size:36px; margin:0 3px">500</span>个积分</h2>			
		</div>
		<div class="ft">
			<a class="submit-btn-white btn-negative" href="javascript:void(0)"><span class="fore">暂不兑换</span><span class="back">处理中...</span></a>
			<a class="submit-btn-green btn-positive" href="http://ucenter.ehaoyao.com/integral/index.html" target="_blank"><span class="fore">兑换优惠券</span><span class="back">处理中...</span></a>
		</div>
	</div>
   
	<div style="width:1000px; margin:0 auto; position:relative"><div style="position:absolute; width:228px; left: 635px; top: 305px;">
	   <a href="javascript:pop_special();" class="big-link">
			<img src="http://img01.img.ehaoyao.com/zx/uploads/special/2014/12/42724/images/mbtn1.png"  />
	   </a>
	</div> </div>
	<script type="text/javascript" src="http://ucenter.ehaoyao.com/js/api.js"></script>
	<script type="text/javascript">
	function pop_special(){
		if(!login_state){
			//登录弹出窗，登录后重新跳回当前页面
			pop_login("register","http://www.ehaoyao.com/special/2014/12/42724.html");
		}
		else{
			//创建活动
			createActive();
		}
	}
	function createActive(){
		
		var api = new Api();
		
		var params = {
			//常规任务id：后台新建一个任务
			"taskId" : 66
		};
			
		api.taskFinishAjaxCallback = function(json){
			if(json.response.code == 0)
				_alert(json.response.tip);
			else {
				//任务完成后，弹窗提示
				new ehaoyao.component.Tips({           
					id:"marryActive",                                     
					style:"eva-tips-pop hy-global",                                  
					target:$("body"),                                       
					close_btn:true,                               
					content:$('#step2_pop_inside'), //弹窗div id      
					position:"center",    
					stay:true,
					correction:{top:0,left:0},                  
					width:570,                                                                          
					scroll:false,
					mod:true,
					callback:function(fn){
						$("#marryActive .btn-negative").off("click").on("click", function(){
							fn();
						});
					}
				});
			}
		};
		
		/**
			查看任务：http://ucenter.ehaoyao.com/single/task/index.jsonp
			领取任务：http://ucenter.ehaoyao.com/flow/singleTaskProgress.jsonp
			完成任务：http://ucenter.ehaoyao.com/task/finish.jsonp
		**/
		api.localAjax("http://ucenter.ehaoyao.com/single/task/index.jsonp", {}, function(json) {
			api.localAjax("http://ucenter.ehaoyao.com/flow/singleTaskProgress.jsonp", params, function(json) {
				var list = json.list;
				var id = list[0].id;
				var type = list[0].taskType;
				var completeId = list[0].pointTaskCompleteInfoId;
				var completeStatus = list[0].completeStatus;
				if(completeStatus == 3){
					var params = "taskInfoId="+id+"&taskCompleteInfoId="+completeId+"&taskType="+type;
					api.localAjax("http://ucenter.ehaoyao.com/task/finish.jsonp" , params , api.taskFinishAjaxCallback , "get");
				}
				else if(completeStatus == 4){
					_alert("积分已经领取！");
				}
				else{
					_alert("非法操作！");
				}
			}, "get");
		},"get")
	}
	
   </script>